package battlezone;

import javax.media.j3d.*;

public class Projectile extends BattlezoneObject {
    private static Configuration _configuration = Configuration.getInstance();
    
    public Model.MoveProjectileTask moveTask;
    
    public Projectile(float positionX, float positionY, float azimuth) {
        super(positionX, positionY, azimuth, new Shape3D(_configuration.getProjectileGeometry()));
    }
    
    @Override
    public void die() {
        if (_isDead == false) {
            _isDead = true;
            dispose();
        }
    }
    
    @Override
    public void dispose() {
        super.dispose();
        if (moveTask != null) { //if the projectile does not belong to this player, it won't have a move task
            moveTask.cancel();
        }
    }
}